/* calloc.c,writen by Yuan HaiDong ,2000-24-3*/

#include <string.h>
#include <stdlib.h>

#ifdef SYS_LIB
_PTR _DEFUN (_calloc, (n, size),size_t n _AND size_t size)
#else
_PTR _DEFUN (calloc, (n, size),size_t n _AND size_t size)
#endif
{

  unsigned int realsize;
  void *ptr;

  if(size == 0 || n == 0)
     return((void *)0);

  realsize = n*size;
#ifdef SYS_LIB
	ptr=_malloc(realsize);
#else
	ptr=malloc(realsize);
#endif
  

  if (ptr == (void *)0)
     return(ptr);

  if(ptr!=NULL)
     memset( ptr, 0, realsize );

  return ptr;
}

